import 'package:flutter/material.dart';
import 'package:flutterdouban/pages/subject/subject_detail.dart';

class JKSubjectContent extends StatefulWidget {
  @override
  _JKSubjectContentState createState() => _JKSubjectContentState();
}

class _JKSubjectContentState extends State<JKSubjectContent> {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: JKSubjectHome(),
    );
  }
}

class JKSubjectHome extends StatefulWidget {
  @override
  _JKSubjectHomeState createState() => _JKSubjectHomeState();
}

class _JKSubjectHomeState extends State<JKSubjectHome> {
  String _message = '书影集原始数据';
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Text('$_message'),
          RaisedButton(
            child: Text('跳转 书影集 详情'),
            onPressed: () {
              print('跳转 书影集 详情');
              _jumpToHomeDtail(context);
            },
          ),

        ],
      ),
    );
  }

  void _jumpToHomeDtail(BuildContext context) {
    Future result = Navigator.of(context).pushNamed(JKSubjectDetailPage.routeName, arguments: '我是参数');
    result.then((value) {
      setState(() {
        _message = value;
      });
      print('返回的结果是：$value');
    });
  }
  /*
  * void _jumpToHomeDtail(BuildContext context) {
    Future result = Navigator.of(context).push(MaterialPageRoute(
      builder: (ctx) {
        return JKSubjectDetailPage();
      }
    ));

    result.then((value) {
      setState(() {
        _message = value;
      });
      print('返回的结果是：$value');
    });
  }*/
}

